<?php


/**
 * 回答点赞
 */
class AskDetailLikeAction extends ActionPlugin
{
    public const USER_LEVEL = self::LEVEL_REALNAME;

    /**
     * @throws Exception
     */
    public function main()
    {
        $answerId = $this->getPost('answer_id', 0);
        $uid = $this->uid;

        \Biz\service\Store\StoreAskService::likeAnswer((int)$answerId, (int)$uid);

        \Doraemon\tools\ActionLog::log($this->uid, [
            'answer_id' => $answerId,
            'uid' => $uid,
        ], \Doraemon\tools\ActionLog::STORE_ASK_LIKE);

        $this->setSuccess('success');
    }

}